package tgc.edu.ljc.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


import tgc.edu.ljc.entity.TbMenu;
import tgc.edu.ljc.service.TbMenuService;



@Controller
public class IndexController {
	
	@Autowired
	private TbMenuService menuService;
	
	@RequestMapping(value= {"/", "index", "login"}, method=RequestMethod.GET)
	public String index() {
		return "main/index";
	}
	
	@RequestMapping(value="/main")
	public String main(ModelMap map) {
		// 加载菜单
		List<TbMenu> menus = menuService.findAuditMenu();
		map.put("menus", menus);
		if (menus.isEmpty()) {
			return "main/shouye";
		}
		    return "main/main";
	}
	@RequestMapping(value="/shouye")
	public String shouye() {
		return "main/shouye";
	}
}
